-
There's no native struct concept — but NASM gives you two common patterns to simulate them:
-
Manual
equoffsets (what the code uses)COIN_X equ 0 COIN_Y equ 4 COIN_RADIUS equ 8 COIN_ACTIVE equ 12 COIN_SIZE equ 16 ; Access feels like struct field access: movss xmm0, [coins + r14 + COIN_X] movss xmm1, [coins + r14 + COIN_Y] -
struc/endstruc— NASM's built-in macro for this-
strucjust runs theresXdirectives to compute offsets automatically — it still doesn't allocate memory. -
To actually allocate an instance you still use
.bssor.data:
struc Coin .x: resd 1 ; 4 bytes (float) .y: resd 1 .radius: resd 1 .active: resd 1 endstruc ; NASM auto-generates Coin.x=0, Coin.y=4, Coin.radius=8, Coin.active=12 ; and Coin_size=16 ; Usage — identical machine code, but safer: movss xmm0, [coins + r14 + Coin.x] movss xmm1, [coins + r14 + Coin.y] -